package com.itany.thread.test02;

public class WaitTwoThread extends Thread{
	private Object obj;
	public WaitTwoThread(Object obj) {
		this.obj = obj;
	}
	@Override
	public void run() {
		synchronized (obj) {
			System.out.println(getName()+"释放锁,即将进入等待池");
			try {
				// 不设置时间,表示无限等待
				// 如果没有人唤醒,永远不会结束
				obj.wait();
			} catch (InterruptedException e) {
				e.printStackTrace();
			}
		}
		
		System.out.println(getName()+"执行完成");
	}
}
